<?php

use yii\db\Migration;

/**
 * Handles the creation of table `{{%contact}}`.
 */
class m240307_074305_create_contact_table extends Migration
{
    /**
     * {@inheritdoc}
     */
    public function safeUp()
    {
        $this->createTable('{{%contact}}', [
            'id' => $this->primaryKey(),

            'name' => $this->string(),
            'mobile' => $this->string(),
            'avatar' => $this->string(),
            'source' => $this->integer()->defaultValue(0)->comment('0 for WeChat'),

            'createdAt' => $this->datetime()->defaultExpression('CURRENT_TIMESTAMP'),
            'updatedAt' => $this->datetime()->defaultExpression('CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP'),
        ]);
    }

    /**
     * {@inheritdoc}
     */
    public function safeDown()
    {
        $this->dropTable('{{%contact}}');
    }
}
